package com.len.service.impl;

import com.len.base.BaseMapper;
import com.len.base.impl.BaseServiceImpl;
import com.len.entity.TQuotation;
import com.len.mapper.QuotationMapper;
import com.len.service.QuotationService;
import com.len.util.JsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service

public class QuotationServiceImpl extends BaseServiceImpl<TQuotation,String> implements
        QuotationService {

    @Autowired
    private QuotationMapper quotationMapper;
    @Override
    public BaseMapper<TQuotation, String> getMappser() {
        return quotationMapper;
    }

    @Override
    public JsonUtil del(String id) {
        JsonUtil json = new JsonUtil();
        boolean isDel = quotationMapper.deleteByPrimaryKey(id) > 0;
        if (isDel) {
            json.setMsg("删除成功");
            json.setFlag(true);
        } else {
            json.setMsg("删除失败");
        }
        return json;
    }

    public List<TQuotation> selectListByOrderNo(String orderNo){
        return quotationMapper.selectListByOrderNo(orderNo);
    }
}
